home *** CD-ROM | disk | FTP | other *** search
/ LiquidLibrary 2005 February / LiquidLibrary 2005 February - Disc 1.iso / pc / Portfolio Browser / Filters / PDF / LIB / gs_kanji.ps < prev    next >
Text File  |  2003-01-03  |  4KB  |  149 lines

  1. %    Copyright (C) 1994, 1995, 1996 Aladdin Enterprises.  All rights reserved.
  2. % This software is licensed to a single customer by Artifex Software Inc.
  3. % under the terms of a specific OEM agreement.
  4.  
  5. % $RCSfile$ $Revision$
  6. % Scaffolding for Kanji fonts.  This is based on the Wadalab free font
  7. % from the University of Tokyo; it may not be appropriate for other
  8. % Kanji fonts.
  9.  
  10. /currentglobal where
  11.  { pop currentglobal { setglobal } true setglobal }
  12.  { { } }
  13. ifelse
  14.  
  15. % Define the encoding for the root font.
  16.  
  17. /KanjiEncoding
  18. % \x00
  19.     0    0    0    0    0    0    0    0
  20.     0    0    0    0    0    0    0    0
  21.     0    0    0    0    0    0    0    0
  22.     0    0    0    0    0    0    0    0
  23. % \x20
  24.     0    1    2    3    4    5    6    7
  25.     8    0    0    0    0    0    0    0
  26.     9    10    11    12    13    14    15    16
  27.     17    18    19    20    21    22    23    24
  28. % \x40
  29.     25    26    27    28    29    30    31    32
  30.     33    34    35    36    37    38    39    40
  31.     41    42    43    44    45    46    47    48
  32.     49    50    51    52    53    54    55    56
  33. % \x60
  34.     57    58    59    60    61    62    63    64
  35.     65    66    67    68    69    70    71    72
  36.     73    74    75    76    77    0    0    0
  37.     0    0    0    0    0    0    0    0
  38. % \x80
  39.     0    0    0    0    0    0    0    0
  40.     0    0    0    0    0    0    0    0
  41.     0    0    0    0    0    0    0    0
  42.     0    0    0    0    0    0    0    0
  43. % \xA0
  44.     0    1    2    3    4    5    6    7
  45.     8    0    0    0    0    0    0    0
  46.     9    10    11    12    13    14    15    16
  47.     17    18    19    20    21    22    23    24
  48. % \xC0
  49.     25    26    27    28    29    30    31    32
  50.     33    34    35    36    37    38    39    40
  51.     41    42    43    44    45    46    47    48
  52.     49    50    51    52    53    54    55    56
  53. % \xE0
  54.     57    58    59    60    61    62    63    64
  55.     65    66    67    68    69    70    71    72
  56.     73    74    75    76    77    0    0    0
  57.     0    0    0    0    0    0    0    0
  58. 256 packedarray def
  59.  
  60. % Define a stub for the base font encoding.
  61.  
  62.   /KanjiSubEncoding { /KanjiSubEncoding .findencoding } bind def
  63. %% Replace 3 (gs_ksb_e.ps)
  64.   EncodingDirectory /KanjiSubEncoding
  65.    { (gs_ksb_e.ps) //systemdict begin runlibfile KanjiSubEncoding end }
  66.   bind put
  67.  
  68. % Support procedures and data.
  69.  
  70. /T1FontInfo 8 dict begin
  71.   /version (001.001) readonly def
  72.   /FullName (KanjiBase) readonly def
  73.   /FamilyName (KanjiBase) readonly def
  74.   /Weight (Medium) readonly def
  75.   /ItalicAngle 0 def
  76.   /isFixedPitch false def
  77.   /UnderlinePosition 0 def
  78.   /UnderlineThickness 0 def
  79. currentdict end readonly def
  80.  
  81. /T1NF            % <fontname> T1NF <font>
  82. {
  83. 20 dict begin
  84.   /FontName exch def
  85.   /FontType 1 def
  86.   /FontInfo T1FontInfo def
  87.   /FontMatrix [.001 0 0 .001 0 0] def
  88.   /FontBBox [0 0 1000 1000] def
  89.   /Encoding KanjiSubEncoding def
  90.   /CharStrings 150 dict def
  91.   /PaintType 0 def
  92.   /Private 2 dict def
  93.   Private begin
  94.     /BlueValues [] def
  95.     /password 5839 def
  96.   end
  97. FontName currentdict end definefont
  98. } def
  99.  
  100. /T0NF            % <fontname> T0NF <font>
  101. {
  102. 20 dict begin
  103.   /FontName exch def
  104.   /FDepVector exch def
  105.   /FontType 0 def
  106.   /FontMatrix [1 0 0 1 0 0] def
  107.   /FMapType 2 def
  108.   /Encoding KanjiEncoding def
  109. FontName currentdict end definefont
  110. } def
  111.  
  112. % Define the composite font and all the base fonts.
  113.  
  114. /CompNF            % <fontname> CompNF <font>
  115. {
  116. /newname1 exch def
  117. newname1 dup length string cvs /str exch def
  118. str length /len exch def
  119. /fdepvector 78 array def 
  120. /j 1 def
  121. 16#21 1 16#74 {
  122. /i exch def
  123. KanjiEncoding i get 0 gt {
  124. len 4 add string /newstr exch def
  125. newstr 0 str putinterval
  126. newstr len (.r) putinterval
  127. newstr len 2 add  i 16 2 string cvrs putinterval
  128. newstr cvn /newlit exch def
  129. newlit T1NF /newfont exch def
  130. fdepvector j newfont put
  131. /j j 1 add def
  132. } if
  133. } for
  134. fdepvector 0 fdepvector 1 get put
  135. /j 0 def
  136. fdepvector newname1 T0NF
  137. } def
  138.  
  139. % Define an individual character in a composite font.
  140. /CompD            % <charstring> <(HL)> CompD -
  141.  { currentfont /Encoding get 1 index 0 get get    % FDepVector index
  142.    currentfont /FDepVector get exch get        % base font
  143.    dup /Encoding get 3 -1 roll 1 get get    % base font character name
  144.    exch /CharStrings get exch 3 -1 roll put
  145.  } bind def
  146.  
  147. exec
  148.